package dotenv

import (
	"log"
	"os"

	"github.com/joho/godotenv"
)

func Init() {
  if os.Getenv("RELEASE_MODE") == "" {
    readEnv()
  }
}

func readEnv() {
	path := os.Getenv("DOTFILE_PATH")
	var err error
	if path == "" {
		err = godotenv.Load()
	} else {
		err = godotenv.Load(path)
	}
	if err != nil {
		log.Fatalf("ERROR: load .env file at %s\n", path)
	}
}
